#!/usr/bin/env bash
set -euxo pipefail


./scripts/setup-fastlane-env
# brew not working in docker/linux in circleci
# brew update
# brew tap getsentry/tools
# brew install sentry-cli
if ! which sentry-cli;
then
  echo "installing sentry-cli"
  curl -sL https://sentry.io/get-cli/ | bash
else
  echo "sentry-cli already installed"
fi

bundle exec fastlane update_plugins

if ! which aws;
then
  echo "installing aws"
  # install awscli
  curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
  unzip -o -qq awscliv2.zip
  sudo ./aws/install

  # configure awscli
  mkdir -p ~/.aws
  touch ~/.aws/config
  echo "[default]" >> ~/.aws/config
  echo "region = us-east-1" >> ~/.aws/config
  echo "output = json" >> ~/.aws/config
else
  echo "aws already installed"
fi


aws s3 cp s3://artsy-citadel/eigen/release.keystore android/app/release.keystore
aws s3 cp s3://artsy-citadel/eigen/android-secret.json android-secret.json
